package com.hdey.service.chao.impl;

import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdey.mapper.chao.ShenlingMapper;
import com.hdey.pojo.chao.Shenling;
import com.hdey.service.chao.ShenlingService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service("shenlingService")
@Transactional
public class ShenlingServiceImpl extends ServiceImpl<ShenlingMapper, Shenling> implements ShenlingService {

    @Resource
    private ShenlingMapper shenlingMapper;


    @Override
    public Page<Shenling> searchPage(Integer current, Integer size, String applyMasterNo) {
        Page<Shenling> page=new Page<>(current,size);
        LambdaQueryWrapper<Shenling> wrapper=new LambdaQueryWrapper<>();
        wrapper.like(!StringUtils.isEmpty(applyMasterNo), Shenling::getApplyMasterNo,applyMasterNo);
        //wrapper.eq(wuzi.getDictionaryId()!=null,Wuzi::getDictionaryId,wuzi.getDictionaryId());
        shenlingMapper.selectPage(page,wrapper);
        return page;
    }

    @Override
    public void update(Integer applyMasterId) {
        shenlingMapper.update(applyMasterId);
    }
}
